home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / indent.man < prev    next >
Encoding:
Text File  |  1989-04-06  |  14.9 KB  |  397 lines

  1.  
  2.  
  3.  
  4. INDENT                    User Commands                    INDENT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      indent - indent and format C program source
  10.  
  11. SSYYNNOOPPSSIISS
  12.      iinnddeenntt  [ _i_n_p_u_t-_f_i_l_e [ _o_u_t_p_u_t-_f_i_l_e ] ] [ --bbaadd | --nnbbaadd ]
  13.             [ --bbaapp | --nnbbaapp ] [ --bbbbbb | --nnbbbbbb ] [ --bbcc | --nnbbcc ]
  14.             [ --bbll | --bbrr ] [ --cc_n ] [ --ccdd_n ] [ --ccddbb | --nnccddbb ]
  15.             [ --ccee | --nnccee ] [ --ccii_n ] [ --ccllii_n ] [ --dd_n ] [ --ddii_n ]
  16.             [ --ddjj | --nnddjj ] [ --eeii | --nneeii ] [ --ffcc11 | --nnffcc11 ]
  17.             [ --ii_n ] [ --iipp | --nniipp ] [ --ll_n ] [ --llcc_n ]
  18.             [ --llpp | --nnllpp ] [ --nnpprroo ] [ --ppccss | --nnppccss ]
  19.             [ --ppss | --nnppss ] [ --ppssll | --nnppssll ] [ --sscc | --nnsscc ]
  20.             [ --ssoobb | --nnssoobb ] [ --sstt ] [ --ttrrooffff ] [ --vv | --nnvv ]
  21.  
  22. DDEESSCCRRIIPPTTIIOONN
  23.      _I_n_d_e_n_t is a CC program formatter.  It reformats the CC program
  24.      in the _i_n_p_u_t-_f_i_l_e according to the switches.  The switches
  25.      which can be specified are described below. They may appear
  26.      before or after the file names.
  27.  
  28.      NNOOTTEE: If you only specify an _i_n_p_u_t-_f_i_l_e, the formatting is
  29.      done `in-place', that is, the formatted file is written back
  30.      into _i_n_p_u_t-_f_i_l_e and a backup copy of _i_n_p_u_t-_f_i_l_e is written
  31.      in the current directory.  If _i_n_p_u_t-_f_i_l_e is named
  32.      `/blah/blah/file', the backup file is named file._B_A_K.
  33.  
  34.      If _o_u_t_p_u_t-_f_i_l_e is specified, _i_n_d_e_n_t checks to make sure it
  35.      is different from _i_n_p_u_t-_f_i_l_e.
  36.  
  37. OOPPTTIIOONNSS
  38.      The options listed below control the formatting style
  39.      imposed by _i_n_d_e_n_t.
  40.  
  41.      --bbaadd,--nnbbaadd     If --bbaadd is specified, a blank line is forced
  42.                     after every block of declarations.  Default:
  43.                     --nnbbaadd.
  44.  
  45.      --bbaapp,--nnbbaapp     If --bbaapp is specified, a blank line is forced
  46.                     after every procedure body.  Default: --nnbbaapp..
  47.  
  48.      --bbbbbb,--nnbbbbbb     If --bbbbbb is specified, a blank line is forced
  49.                     before every block comment.  Default: --nnbbbbbb..
  50.  
  51.      --bbcc,--nnbbcc       If --bbcc is specified, then a newline is forced
  52.                     after each comma in a declaration. --nnbbcc turns
  53.                     off this option.  The default is --nnbbcc.
  54.  
  55.      --bbrr,--bbll        Specifying --bbll lines up compound statements
  56.                     like this:
  57.                         if (...)
  58.                         {
  59.                             code
  60.  
  61.  
  62.  
  63. Sprite v1.0            September 10, 1985                       1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. INDENT                    User Commands                    INDENT
  71.  
  72.  
  73.  
  74.                         }
  75.                     Specifying --bbrr (the default) makes them look
  76.                     like this:
  77.                         if (...) {
  78.                             code
  79.                         }
  80.  
  81.      --cc_n            The column in which comments on code start.
  82.                     The default is 33.
  83.  
  84.      --ccdd_n           The column in which comments on declarations
  85.                     start.  The default is for these comments to
  86.                     start in the same column as those on code.
  87.  
  88.      --ccddbb,--nnccddbb     Enables (disables) the placement of comment
  89.                     delimiters on blank lines.  With this option
  90.                     enabled, comments look like this:
  91.                          /*
  92.                           * this is a comment
  93.                           */
  94.                     Rather than like this:
  95.                          /* this is a comment */
  96.                     This only affects block comments, not com-
  97.                     ments to the right of code. The default is
  98.                     --ccddbb.
  99.  
  100.      --ccee,--nnccee       Enables (disables) forcing `else's to cuddle
  101.                     up to the immediately preceding `}'.  The
  102.                     default is --ccee.
  103.  
  104.      --ccii_n           Sets the continuation indent to be _n.  Con-
  105.                     tinuation lines will be indented that far
  106.                     from the beginning of the first line of the
  107.                     statement.  Parenthesized expressions have
  108.                     extra indentation added to indicate the nest-
  109.                     ing, unless --llpp is in effect.  --ccii defaults
  110.                     to the same value as --ii.
  111.  
  112.      --ccllii_n          Causes case labels to be indented _n tab stops
  113.                     to the right of the containing sswwiittcchh state-
  114.                     ment.  --ccllii00..55 causes case labels to be
  115.                     indented half a tab stop.  The default is
  116.                     --ccllii00.  (This is the only option that takes a
  117.                     fractional argument.)
  118.  
  119.      --dd_n            Controls the placement of comments which are
  120.                     not to the right of code.  Specifying --dd11
  121.                     means that such comments are placed one
  122.                     indentation level to the left of code.  The
  123.                     default --dd00 lines up these comments with the
  124.                     code.  See the section on comment indentation
  125.                     below.
  126.  
  127.  
  128.  
  129. Sprite v1.0            September 10, 1985                       2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. INDENT                    User Commands                    INDENT
  137.  
  138.  
  139.  
  140.      --ddii_n           Specifies the indentation, in character posi-
  141.                     tions, from a declaration keyword to the fol-
  142.                     lowing identifier.  The default is --ddii1166.
  143.  
  144.      --ddjj,--nnddjj       --ddjj left justifies declarations.  --nnddjj
  145.                     indents declarations the same as code.  The
  146.                     default is --nnddjj.
  147.  
  148.      --eeii,--nneeii       Enables (disables) special eellssee--iiff process-
  149.                     ing.  If enabled, iiffs following eellssees will
  150.                     have the same indentation as the preceding iiff
  151.                     statement.  The default is --eeii.
  152.  
  153.      --ffcc11,--nnffcc11     Enables (disables) the formatting of comments
  154.                     that start in column 1.  Often, comments
  155.                     whose leading `/' is in column 1 have been
  156.                     carefully hand formatted by the programmer.
  157.                     In such cases, --nnffcc11 should be used.  The
  158.                     default is --ffcc11.
  159.  
  160.      --ii_n            The number of spaces for one indentation
  161.                     level.  The default is 8.
  162.  
  163.      --iipp,--nniipp       Enables (disables) the indentation of parame-
  164.                     ter declarations from the left margin.  The
  165.                     default is --iipp.
  166.  
  167.      --ll_n            Maximum length of an output line.  The
  168.                     default is 78.
  169.  
  170.      --llpp,--nnllpp       Lines up code surrounded by parenthesis in
  171.                     continuation lines.  If a line has a left
  172.                     paren which is not closed on that line, then
  173.                     continuation lines will be lined up to start
  174.                     at the character position just after the left
  175.                     paren.  For example, here is how a piece of
  176.                     continued code looks with --nnllpp in effect:
  177.                         p1 = first_procedure(second_procedure(p2, p3),
  178.                             third_procedure(p4, p5));
  179.                     With --llpp in effect (the default) the code
  180.                     looks somewhat clearer:
  181.                         p1 = first_procedure(second_procedure(p2, p3),
  182.                                              third_procedure(p4, p5));
  183.                     Inserting two more newlines we get:
  184.                         p1 = first_procedure(second_procedure(p2,
  185.                                                               p3),
  186.                                              third_procedure(p4,
  187.                                                              p5));
  188.  
  189.      --nnpprroo          Causes the profile files, `./.indent.pro' and
  190.                     `~/.indent.pro', to be ignored.
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0            September 10, 1985                       3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. INDENT                    User Commands                    INDENT
  203.  
  204.  
  205.  
  206.      --ppccss,--nnppccss     If true (--ppccss) all procedure calls will have
  207.                     a space inserted between the name and the
  208.                     `('.  The default is --nnppccss.
  209.  
  210.      --ppss,--nnppss       If true (--ppss) the pointer following operator
  211.                     `->' will be surrounded by spaces on either
  212.                     side.  The default is --nnppss.
  213.  
  214.      --ppssll,--nnppssll     If true (--ppssll) the names of procedures being
  215.                     defined are placed in column 1 - their types,
  216.                     if any, will be left on the previous lines.
  217.                     The default is --ppssll.
  218.  
  219.      --sscc,--nnsscc       Enables (disables) the placement of asterisks
  220.                     (`*'s) at the left edge of all comments.  The
  221.                     default is --sscc.
  222.  
  223.      --ssoobb,--nnssoobb     If --ssoobb is specified, indent will swallow
  224.                     optional blank lines.  You can use this to
  225.                     get rid of blank lines after declarations.
  226.                     Default: --nnssoobb.
  227.  
  228.      --sstt            Causes iinnddeenntt to take its input from stdin,
  229.                     and put its output to stdout.
  230.  
  231.      --TT_t_y_p_e_n_a_m_e     Adds _t_y_p_e_n_a_m_e to the list of type keywords.
  232.                     Names accumulate: --TT can be specified more
  233.                     than once.  You need to specify all the
  234.                     typenames that appear in your program that
  235.                     are defined by ttyyppeeddeeffs - nothing will be
  236.                     harmed if you miss a few, but the program
  237.                     won't be formatted as nicely as it should.
  238.                     This sounds like a painful thing to have to
  239.                     do, but it's really a symptom of a problem in
  240.                     C: ttyyppeeddeeff causes a syntactic change in the
  241.                     language and _i_n_d_e_n_t can't find all ttyyppeeddeeffs.
  242.  
  243.      --ttrrooffff         Causes iinnddeenntt to format the program for pro-
  244.                     cessing by troff.  It will produce a fancy
  245.                     listing in much the same spirit as vvggrriinndd.
  246.                     If the output file is not specified, the
  247.                     default is standard output, rather than for-
  248.                     matting in place.
  249.  
  250.      --vv,--nnvv         --vv turns on `verbose' mode; --nnvv turns it off.
  251.                     When in verbose mode, _i_n_d_e_n_t reports when it
  252.                     splits one line of input into two or more
  253.                     lines of output, and gives some size statis-
  254.                     tics at completion. The default is --nnvv.
  255.  
  256. FFUURRTTHHEERR DDEESSCCRRIIPPTTIIOONN
  257.      You may set up your own `profile' of defaults to _i_n_d_e_n_t by
  258.  
  259.  
  260.  
  261. Sprite v1.0            September 10, 1985                       4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. INDENT                    User Commands                    INDENT
  269.  
  270.  
  271.  
  272.      creating a file called .._i_n_d_e_n_t.._p_r_o in either your login
  273.      directory and/or the current directory and including what-
  274.      ever switches you like.  Switches in `.indent.pro' in the
  275.      current directory override those in your login directory
  276.      (with the exception of --TT type definitions, which just accu-
  277.      mulate).  If _i_n_d_e_n_t is run and a profile file exists, then
  278.      it is read to set up the program's defaults.  The switches
  279.      should be separated by spaces, tabs or newlines.  Switches
  280.      on the command line, however, override profile switches.
  281.  
  282.      CCoommmmeennttss
  283.  
  284.      `_B_o_x' _c_o_m_m_e_n_t_s.  _I_n_d_e_n_t assumes that any comment with a dash
  285.      or star immediately after the start of comment (that is,
  286.      `/*-' or `/**') is a comment surrounded by a box of stars.
  287.      Each line of such a comment is left unchanged, except that
  288.      its indentation may be adjusted to account for the change in
  289.      indentation of the first line of the comment.
  290.  
  291.      _S_t_r_a_i_g_h_t _t_e_x_t.  All other comments are treated as straight
  292.      text.  _I_n_d_e_n_t fits as many words (separated by blanks, tabs,
  293.      or newlines) on a line as possible.  Blank lines break para-
  294.      graphs.
  295.  
  296.      CCoommmmeenntt iinnddeennttaattiioonn
  297.  
  298.      If a comment is on a line with code it is started in the
  299.      `comment column', which is set by the --cc_n command line
  300.      parameter.  Otherwise, the comment is started at _n indenta-
  301.      tion levels less than where code is currently being placed,
  302.      where _n is specified by the --dd_n command line parameter.  If
  303.      the code on a line extends past the comment column, the com-
  304.      ment starts further to the right, and the right margin may
  305.      be automatically extended in extreme cases.
  306.  
  307.      PPrreepprroocceessssoorr lliinneess
  308.  
  309.      In general, _i_n_d_e_n_t leaves preprocessor lines alone.  The
  310.      only reformatting that it will do is to straighten up trail-
  311.      ing comments.  It leaves embedded comments alone.  Condi-
  312.      tional compilation (##iiffddeeff......##eennddiiff) is recognized and
  313.      _i_n_d_e_n_t attempts to correctly compensate for the syntactic
  314.      peculiarities introduced.
  315.  
  316.      CC ssyynnttaaxx
  317.  
  318.      _I_n_d_e_n_t understands a substantial amount about the syntax of
  319.      C, but it has a `forgiving' parser.  It attempts to cope
  320.      with the usual sorts of incomplete and misformed syntax.  In
  321.      particular, the use of macros like:
  322.              #define forever for(;;)
  323.      is handled properly.
  324.  
  325.  
  326.  
  327. Sprite v1.0            September 10, 1985                       5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. INDENT                    User Commands                    INDENT
  335.  
  336.  
  337.  
  338. FFIILLEESS
  339.      ./.indent.pro  profile file
  340.      ~/.indent.pro  profile file
  341.  
  342. BBUUGGSS
  343.      _I_n_d_e_n_t has even more switches than _l_s.
  344.  
  345.      A common mistake that often causes grief is typing:
  346.          indent *.c
  347.      to the shell in an attempt to indent all the CC programs in a
  348.      directory.  This is probably a bug, not a feature.
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393. Sprite v1.0            September 10, 1985                       6
  394.  
  395.  
  396.  
  397.